home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CLPMOUSE.ARJ / WIND.DOC < prev    next >
Text File  |  1991-01-21  |  10KB  |  244 lines

  1. WINDOWS for CLIPPER 5.0  (c) Matthew S. Staben  1991
  2. -----------------------
  3.  
  4. Unfortunately, with the release of CLIPPER 5.0, no real windowing functions 
  5. were implemented which would have made the screen layouts much easier to work
  6. with.  To make up for what is lacking, I have programmed (for all audiences)
  7. a series of functions which utilize the functions which CLIPPER 5.0 did have 
  8. for the programmer who needs a windowing environment without having to program
  9. it all.
  10.  
  11. Essential Information on the windowing capabilities:
  12.  
  13. Memory requirements above the LOAD size:
  14.  
  15. The only requirement for memory is that a maximum of characters which will fit
  16. on the screen must have a buffer of the same size.  This can be calculated by
  17. the following function:
  18.  
  19. ------------------------------------------
  20. FUNCTION MAX_FLASH
  21. /* To return the number of bytes */
  22. /* which will be needed to guarantee */
  23. /* correct operation. */
  24.  
  25. return(64+(maxrow()*maxcol())
  26. ------------------------------------------
  27.  
  28. The size returned by this function is the "FLASH POTENTIAL" factor.  To 
  29. guarantee successful running of these functions, this flash potential *must*
  30. be compensated for.  For WINMOVE, WINMOVETO, WINSWAP, multiply the value by 2.
  31.  
  32. Other than this, all windowing is virtually stacked into a disk file, either in
  33. the current directory or the SWAPPATH directory.  The windowing file is limited
  34. only by diskspace.  Due to the efficient nature of programming, disk caching or
  35. using a RAM drive will affect performance only by a small degree unless the
  36. program is entirely floppy based.
  37.  
  38. The stack is a "LIFO" stack.  Only the last opened window may be closed,
  39. freeing the stack information beneath.  One command, "WINSWAP()" will swap
  40. the last two stack entries, thus making the 2nd to last window opened, the
  41. last one.
  42.  
  43. All CLIPPER functions which had some form of screen output, except for the 
  44. savescreen() and restscreen() functions have been supplemented to.  A library
  45. file contains the following functions:
  46.  
  47. NOTE:  These functions will work in any screen mode, except that shadows will
  48.        not appear in 40 columns since shadows ARE attribute changes.
  49.  
  50. WININIT(<expC>,<expL>)
  51.  
  52. This will initialize all windowing environment needs.  In order to use any
  53. windowing capabilities, this command must be used first.  
  54. <expC> specifies a filename to be used as the windows file.
  55. <expL> specifies whether or not the SWAPPATH statement should be used.
  56. ie, WININIT("WINFIL.WIN",.T.)
  57.  
  58. ** This requires two (2) RESERVED words.  WINHNDL and WINFIL.  Using these two
  59.    as variables will cause the system to fail.
  60.    
  61. WINDONE()
  62. This will close down all windowing environment settings caused by WININIT().  
  63. Essentially, it erases the windows file.  
  64. ie, WINDONE()
  65. Returns (.T.) if successful, (.F.) if not.
  66.  
  67. WINBACK(<expC>)
  68. This function will create a background for the windows to use.  This is termed
  69. as a window.
  70. <expC> must be a single character.
  71. ie, WINBACK(chr(177))
  72.  
  73. ** Don't forget to set your colors!
  74.  
  75. WINOPEN(<expN1>,<expN2>,<expN3>,<expN4>,<expL1>[,<expC1>,<expC2>])
  76. This function will open a window at the specified N1,N2 coordinates, which is
  77. N3 tall and N4 wide.  <expL1> is the shadow toggle, <expC1> is the title of 
  78. the window (which is centered on the top line, and <expC2> is the color for 
  79. the window title.
  80. ie, WINOPEN(10,5,12,30,.f.,"Window 1",title_color)
  81.  
  82. * IF <expL1> is set to TRUE, the window is a color BOX with NO shadow.  If it
  83.   it is FALSE, the window is a color AREA with a shadow.
  84.  
  85. ** The color of the window is determined by the current color setting.  The
  86.    color of the title is the foreground with the window color's background.
  87.    
  88. WINCLOSE(<expN>)
  89. This function will close the last opened window for <expN> times.  If <expN>
  90. is omitted, one (1) is assumed.
  91. ie, WINCLOSE(5)  --  WINCLOSE()
  92.  
  93. WINSIZE(<expN1>,<expN2>[,<expL1>])
  94. This function will size a the current window based on two separate types of 
  95. parameters.  If (expL1) is TRUE, the N1 and N2 parameters are relative, 
  96. otherwise they are actual (as in WINOPEN).  This will attempt to preserve the
  97. data in the window.  (if <expL1> is omitted, it defaults to TRUE.)
  98. ie, WINSIZE(-5,-5,.T.)  => This will shrink a window by five rows and columns.
  99.     WINSIZE(5,5,.T.)    => This will enlarge a window by five rows and columns.
  100.     WINSIZE(10,33,.F.)  => This will force the window to 10 rows and columns.
  101.     
  102. WINTOTAL()
  103. This function will return the number of opened windows.  
  104. ie, total = WINTOTAL()
  105.     
  106. WINSWAP()
  107. This function will cause the last two windows opened to be swapped so that
  108. the writing routines may be used on alternate windows.
  109.  
  110. WINMOVE(<expN1>,<expN2>)
  111. This function will move the last opened window N1 columns to the vertical,
  112. and N2 columns to the horizontal.   
  113. ie, WINMOVE(-5,3)  --  WINMOVE(2,5)
  114.  
  115. ** This will move the window to the edges of the screen, but no more.  To
  116.    move a window to the extreme edges of the screen, use a larger than real
  117.    number.
  118.    
  119. WINMOVETO(<expN1>,<expN2>,<expN3>)
  120. This function will move the last opened window to the X,Y coordinates held in
  121. <expN1> and <expN2>.  <expN3> is the number of steps to take while going to
  122. the new coordinates.  The higher the number, the smoother the move is.
  123. ie, WINMOVETO(5,2,5)  --  WINMOVETO(1,1,8)
  124.    
  125. WINSAY(<expN1>,<expN2>,<expV1>[,<expC2>])
  126. This function emulates an @ SAY command with an offset to the window instead
  127. of the actual screen coordinates.  <expC2> is the picture string which must be
  128. enclosed in quotes.
  129. ie, WINSAY(1,1,"$ and cents : ")  --  WINSAY(1,20,value+(value*.78),"@)")
  130.  
  131. WINGET(<expN1>,<expN2>,<expC1>,<expC2>[,<expC3>])
  132. This function emulates an @ SAY GET command with an offset to the window 
  133. specified by N1'th row, N2'th column instead of the actual screen coordinates.
  134. <expC1> is the quotation to say, and <expC2> is the variable name (in quotes).
  135. <expC3> is the picture string which must be enclosed in quotes.
  136. ie, WINGET(1,1,"Enter $ and cents : ","value","9999.99")
  137.  
  138. WINPROMPT(<expN1>,<expN2>,<expC1>[,<expC2>])
  139. This function emulates an @ PROMPT command with an offset in the window
  140. instead of the actual screen coordinates.  N1'th row, N2'th column, <expC1> is
  141. the prompt's string, <expC2> is the message string which must be enclosed in 
  142. quotes.
  143. ie, WINPROMPT(1,1,"0. Enter Database","This will enter the database")
  144.     WINPROMPT(2,1,"1. Quit to DOS")
  145.     MENU TO _vbl
  146.     
  147. WINBOX(<expN1>,<expN2>,<expN3>,<expN4>,<expC>)
  148. This function emulates the @ X,Y,X1,Y1 BOX "ccccccccc" command.  The box will
  149. be displayed in the window's coordinate system.  The <expC> must be provided.
  150. Refer to the documentation for the correct string format.
  151. ie, WINBOX(1,1,5,5,box_frame)
  152.  
  153. WINCLEARTO(<expN1>,<expN2>,<expN3>,<expN4>)
  154. This function emulates the @ X,Y clear to X1,Y1 command.  The cleared area will
  155. remain within the windows coordinate system.
  156. ie, WINCLEARTO(1,2,3,8)
  157.  
  158. WINLINE(<expN1>,<expN2>,<expN3>,<expN4>[,<expN5>])
  159. This function emulates the @ X,Y to X1,Y1 single/DOUBLE command.  <expN5> 
  160. defaults to single line if not specified.  A two (2) for <expN5> will result 
  161. in a double line, a one (1) single.
  162. ie, WINLINE(1,3,1,5,2)
  163.  
  164. WINCLEAR()
  165. This function will clear the current window.
  166. ie, WINCLEAR()
  167.  
  168. WINCOLOR(<expN>)
  169. This function will change the color attributes by <expN> values.  Refer to the
  170. IBM Technical manual for more information on attribute colors.  This does NOT
  171. require the ANSI.SYS sub-program to be loaded.
  172. ie, WINCOLOR(8)
  173.  
  174. * BONUS FUNCTION *
  175.  
  176. WIN_SGRAPH(<expN1>,<expN2>,<expN3>,<expC1>[,<expN4>,<expN5>,<expN6>,<expC2>)
  177. This function has three different modes. 
  178.  
  179. 1. Start Graph.  ie, win_sgraph(0,0,1,color_var,row,column,width,wording)
  180. 2. Update Graph. ie, win_sgraph(total,current,2,color_var)
  181. 3. End of Graph. ie, win_sgraph(0,0,3)
  182.  
  183. The graph is adjusted according to the width specified.  An idea graph
  184. situation would be as follows:
  185.  
  186. This function opens the graph as a window with NO shadow.  So, it is 
  187. recommended that no other screen updates are used since it would require
  188. a winswap() call.  
  189.  
  190. win_sgraph(0,0,1,color_status,10,25,50,"Reading Database")
  191. do while .not. eof() .and. win_sgraph(reccount(),recno(),2,color_status)
  192.    <statements>
  193.    skip
  194. enddo
  195. win_sgraph(0,0,3)
  196.  
  197. WINACHOICE(<expC1>)
  198. This function emulates the ACHOICE function in its entirety, except the window
  199. specifies the ACHOICE coordinates.  The parameter is passed as a string.  
  200. ie, WINACHOICE("array1,array2,startat,scrlocat")
  201.     WINACHOICE("array1,.T.")
  202.     
  203. WINBROWSE()
  204. This function emulates the BROWSE function except that the coordinates are not 
  205. specified.  The window is used as the browse area.
  206. ie, WINBROWSE()
  207.  
  208. WINMEMOEDIT(<expC1>)
  209. This function emulates the MEMOEDIT function except that the coordinates are
  210. not specified.  The window is used as the memo area.  The parameter is a string
  211. exactly as one would use it during a normal memoedit use.
  212. ie, WINMEMOEDIT(".F.,.T.)
  213.  
  214. WINTBNEW()
  215. This function emulates the TBROWSENEW() function except the window forms the
  216. coordinates.
  217. ie, WINTBNEW()
  218.  
  219. WINTBDB()
  220. This function emulates the TBROWSEDB() function except the window forms the
  221. coordinates.
  222. ie, WINTBDB()
  223.  
  224.  
  225.  
  226. Additional Notes:
  227.  
  228. All these functions are released as PUBLIC DOMAIN to the general CLIPPER
  229. public.  However, source code is available for a nominal fee from:
  230.  
  231. Matthew S. Staben
  232. 811 West 14th Avenue
  233. Spokane, WA  99204
  234. Attn: Clipper Stuff
  235.  
  236.  
  237. Usage:
  238. Specify the CLPWIN52.LIB as a library when linking.
  239.  
  240.  
  241. If there are any requests for additional work involving CLIPPER, windowing
  242. for CLIPPER, or any programming in general, the above address will generate
  243. instant response.
  244.